{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/bjw9936/Desktop/Polo_Welsh_IO/01_Main/main_log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}15 Apr 2024, 17:45:07

{com}. do "/Users/bjw9936/Desktop/Polo_Welsh_IO/01_Main/main.do"
{txt}
{com}. **********************************************
. * VIOLENT COMPETITION AND TERRORIST RESTRAINT
. * 
. * Sara M.T. Polo (University of Essex)
. * sara.polo@essex.ac.uk
. *
. * Blair Welsh (NYU - Abu Dhabi)
. * blairwelsh@nyu.edu
. *
. * International Organization, 2024
. **********************************************
. 
. * Change to respective directory
. cd "/Users/bjw9936/Desktop/Polo_Welsh_IO/01_Main"
{res}/Users/bjw9936/Desktop/Polo_Welsh_IO/01_Main
{txt}
{com}. 
. **********************************************
. * FIGURE 1 & 2
. **********************************************
. 
. use figure1.dta, clear
{txt}
{com}. graph hbar infight, over(gtdname, sort(1)) ytitle("Number of Attacks on Other Organizations", size(small)) bar(1, fcolor(black)) ylabel(, labsize(small) nogrid)
{res}{txt}
{com}. 
. use figure2a.dta, clear
{txt}
{com}. twoway (bar deaths date, sort ytitle("") xtitle("") tlabel(1989m1(48)2018m12) xlabel(, grid) ylabel(, grid) color(navy))
{res}{txt}
{com}. 
. use figure2b.dta, clear
{txt}
{com}. twoway (bar infight date, sort ytitle("") xtitle("") tlabel(1989m1(48)2018m12) xlabel(, grid) ylabel(, grid) color(navy))
{res}{txt}
{com}. 
. **********************************************
. * MACRO-LEVEL ANALYSIS
. **********************************************
. 
. * Set up
. use main.dta, clear
{txt}
{com}. xtset newid iyear
{res}
{col 1}{txt:Panel variable: }{res:newid}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:iyear}{txt:, }{res:{bind:1970}}{txt: to }{res:{bind:2018}}{txt:, but with gaps}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. set scheme s1color
{txt}
{com}. 
. * Summary Statistics (Table 1)
. summarize softratio infight infight_b ln_infight nat left right rel regimetype foreignspon territory attacks n_group ch_group softratio_lag size ln_gdp ln_pop pts_a efindex

{txt}    Variable {c |}        Obs        Mean    Std. dev.       Min        Max
{hline 13}{c +}{hline 57}
{space 3}softratio {c |}{res}      2,194    .6051892    .3382681          0          1
{txt}{space 5}infight {c |}{res}      2,194    .7174111    3.364252          0         58
{txt}{space 3}infight_b {c |}{res}      2,194    .1672744    .3733057          0          1
{txt}{space 2}ln_infight {c |}{res}      2,194    .3038046    .7881752          0   5.060443
{txt}{space 9}nat {c |}{res}      2,194    .4270738     .494766          0          1
{txt}{hline 13}{c +}{hline 57}
{space 8}left {c |}{res}      2,194    .2269827    .4189768          0          1
{txt}{space 7}right {c |}{res}      2,194    .0082042    .0902252          0          1
{txt}{space 9}rel {c |}{res}      2,194     .189608    .3920802          0          1
{txt}{space 2}regimetype {c |}{res}      2,194    .4384686    .4963126          0          1
{txt}{space 1}foreignspon {c |}{res}      2,194    .3482224    .4765155          0          1
{txt}{hline 13}{c +}{hline 57}
{space 3}territory {c |}{res}      2,194    .3377393     .473047          0          1
{txt}{space 5}attacks {c |}{res}      2,194    31.68551    97.66362          1       1249
{txt}{space 5}n_group {c |}{res}      2,194    79.57293    149.7868          1        806
{txt}{space 4}ch_group {c |}{res}      2,194   -7.355515    80.31327       -449        278
{txt}softra~o_lag {c |}{res}      2,145     .603382    .3375692          0          1
{txt}{hline 13}{c +}{hline 57}
{space 8}size {c |}{res}      2,194    2.455789     .751412          1          4
{txt}{space 6}ln_gdp {c |}{res}      1,975    7.289235    1.245815   3.404073   10.82864
{txt}{space 6}ln_pop {c |}{res}      2,180    17.66872    1.623263   13.31603   21.02533
{txt}{space 7}pts_a {c |}{res}      1,975    3.966582    .9142003          1          5
{txt}{space 5}efindex {c |}{res}      1,431    .5471838    .2308318       .015        .89
{txt}
{com}. 
. * Infighting as Binary Variable (Models 1-3, Table 2)
. glm softratio infight_b, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-1198.8723}  
Iteration 1:{space 2}Log pseudolikelihood = {res:-1198.6722}  
Iteration 2:{space 2}Log pseudolikelihood = {res:-1198.6722}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     2,194
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     2,192
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20}  1349.69957{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70} .6157389
{txt}Pearson{col 18}={res}{col 20} 1047.742034{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70} .4779845

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.094505
{txt}Log pseudolikelihood{col 22}= {res}-1198.672153{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-15514.41

{txt}{ralign 78:(Std. err. adjusted for {res:290} clusters in {res:gtdname})}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}   softratio{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}{col 14}{res}{space 2}-.4640476{col 26}{space 2}  .089775{col 37}{space 1}   -5.17{col 46}{space 3}0.000{col 54}{space 4}-.6400034{col 67}{space 3}-.2880917
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .5072089{col 26}{space 2} .0561669{col 37}{space 1}    9.03{col 46}{space 3}0.000{col 54}{space 4} .3971238{col 67}{space 3}  .617294
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. glm softratio infight_b nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-1157.8765}  
Iteration 1:{space 2}Log pseudolikelihood = {res:-1157.7051}  
Iteration 2:{space 2}Log pseudolikelihood = {res:-1157.7051}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     2,145
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     2,131
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20} 1297.555873{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70} .6088953
{txt}Pearson{col 18}={res}{col 20} 1009.609626{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70} .4737727

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.092499
{txt}Log pseudolikelihood{col 22}= {res}-1157.705062{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-15049.12

{txt}{ralign 79:(Std. err. adjusted for {res:289} clusters in {res:gtdname})}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}    softratio{col 15}{c |} Coefficient{col 27}  std. err.{col 39}      z{col 47}   P>|z|{col 55}     [95% con{col 68}f. interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 4}infight_b {c |}{col 15}{res}{space 2}-.6086601{col 27}{space 2} .0836992{col 38}{space 1}   -7.27{col 47}{space 3}0.000{col 55}{space 4}-.7727076{col 68}{space 3}-.4446127
{txt}{space 10}nat {c |}{col 15}{res}{space 2}-.1500622{col 27}{space 2} .1488019{col 38}{space 1}   -1.01{col 47}{space 3}0.313{col 55}{space 4}-.4417086{col 68}{space 3} .1415843
{txt}{space 9}left {c |}{col 15}{res}{space 2}-.3825622{col 27}{space 2} .1610158{col 38}{space 1}   -2.38{col 47}{space 3}0.018{col 55}{space 4}-.6981474{col 68}{space 3} -.066977
{txt}{space 8}right {c |}{col 15}{res}{space 2} .0821259{col 27}{space 2} .4204001{col 38}{space 1}    0.20{col 47}{space 3}0.845{col 55}{space 4}-.7418432{col 68}{space 3}  .906095
{txt}{space 10}rel {c |}{col 15}{res}{space 2} .2211858{col 27}{space 2} .1612418{col 38}{space 1}    1.37{col 47}{space 3}0.170{col 55}{space 4}-.0948424{col 68}{space 3} .5372139
{txt}{space 3}regimetype {c |}{col 15}{res}{space 2}-.0064149{col 27}{space 2} .1045522{col 38}{space 1}   -0.06{col 47}{space 3}0.951{col 55}{space 4}-.2113334{col 68}{space 3} .1985036
{txt}{space 2}foreignspon {c |}{col 15}{res}{space 2}-.0680728{col 27}{space 2} .0874949{col 38}{space 1}   -0.78{col 47}{space 3}0.437{col 55}{space 4}-.2395596{col 68}{space 3}  .103414
{txt}{space 4}territory {c |}{col 15}{res}{space 2} .1767641{col 27}{space 2} .0855665{col 38}{space 1}    2.07{col 47}{space 3}0.039{col 55}{space 4} .0090569{col 68}{space 3} .3444714
{txt}{space 6}attacks {c |}{col 15}{res}{space 2} .0006513{col 27}{space 2}  .000444{col 38}{space 1}    1.47{col 47}{space 3}0.142{col 55}{space 4}-.0002189{col 68}{space 3} .0015215
{txt}{space 6}n_group {c |}{col 15}{res}{space 2}-.0000274{col 27}{space 2} .0003466{col 38}{space 1}   -0.08{col 47}{space 3}0.937{col 55}{space 4}-.0007066{col 68}{space 3} .0006519
{txt}{space 5}ch_group {c |}{col 15}{res}{space 2}-.0001456{col 27}{space 2} .0003952{col 38}{space 1}   -0.37{col 47}{space 3}0.712{col 55}{space 4}-.0009202{col 68}{space 3} .0006289
{txt}{space 1}conflictyear {c |}{col 15}{res}{space 2} .0998937{col 27}{space 2} .0955576{col 38}{space 1}    1.05{col 47}{space 3}0.296{col 55}{space 4}-.0873958{col 68}{space 3} .2871832
{txt}softratio_lag {c |}{col 15}{res}{space 2} .1968692{col 27}{space 2} .1032913{col 38}{space 1}    1.91{col 47}{space 3}0.057{col 55}{space 4} -.005578{col 68}{space 3} .3993164
{txt}{space 8}_cons {c |}{col 15}{res}{space 2}   .40989{col 27}{space 2} .1746736{col 38}{space 1}    2.35{col 47}{space 3}0.019{col 55}{space 4}  .067536{col 68}{space 3} .7522439
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. glm softratio infight_b nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag size ln_gdp ln_pop pts_a efindex, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-594.45267}  
Iteration 1:{space 2}Log pseudolikelihood = {res:-594.39297}  
Iteration 2:{space 2}Log pseudolikelihood = {res:-594.39297}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     1,121
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     1,102
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20} 641.7039347{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70} .5823085
{txt}Pearson{col 18}={res}{col 20} 499.9408459{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70} .4536668

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.094367
{txt}Log pseudolikelihood{col 22}= {res}-594.3929674{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-7096.514

{txt}{ralign 79:(Std. err. adjusted for {res:165} clusters in {res:gtdname})}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}    softratio{col 15}{c |} Coefficient{col 27}  std. err.{col 39}      z{col 47}   P>|z|{col 55}     [95% con{col 68}f. interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 4}infight_b {c |}{col 15}{res}{space 2}-.5539733{col 27}{space 2} .1203051{col 38}{space 1}   -4.60{col 47}{space 3}0.000{col 55}{space 4} -.789767{col 68}{space 3}-.3181796
{txt}{space 10}nat {c |}{col 15}{res}{space 2}-.4198323{col 27}{space 2}  .175422{col 38}{space 1}   -2.39{col 47}{space 3}0.017{col 55}{space 4}-.7636531{col 68}{space 3}-.0760115
{txt}{space 9}left {c |}{col 15}{res}{space 2}-.5622071{col 27}{space 2} .1718216{col 38}{space 1}   -3.27{col 47}{space 3}0.001{col 55}{space 4}-.8989712{col 68}{space 3} -.225443
{txt}{space 8}right {c |}{col 15}{res}{space 2}  .181999{col 27}{space 2} .4687128{col 38}{space 1}    0.39{col 47}{space 3}0.698{col 55}{space 4}-.7366611{col 68}{space 3} 1.100659
{txt}{space 10}rel {c |}{col 15}{res}{space 2} .1187503{col 27}{space 2} .2119939{col 38}{space 1}    0.56{col 47}{space 3}0.575{col 55}{space 4}  -.29675{col 68}{space 3} .5342506
{txt}{space 3}regimetype {c |}{col 15}{res}{space 2} .1796246{col 27}{space 2} .1428334{col 38}{space 1}    1.26{col 47}{space 3}0.209{col 55}{space 4}-.1003237{col 68}{space 3} .4595729
{txt}{space 2}foreignspon {c |}{col 15}{res}{space 2}-.0175668{col 27}{space 2}   .09354{col 38}{space 1}   -0.19{col 47}{space 3}0.851{col 55}{space 4}-.2009018{col 68}{space 3} .1657682
{txt}{space 4}territory {c |}{col 15}{res}{space 2}-.0791151{col 27}{space 2} .0958558{col 38}{space 1}   -0.83{col 47}{space 3}0.409{col 55}{space 4} -.266989{col 68}{space 3} .1087587
{txt}{space 6}attacks {c |}{col 15}{res}{space 2} .0000597{col 27}{space 2} .0005024{col 38}{space 1}    0.12{col 47}{space 3}0.905{col 55}{space 4}-.0009251{col 68}{space 3} .0010444
{txt}{space 6}n_group {c |}{col 15}{res}{space 2} .0005625{col 27}{space 2} .0023126{col 38}{space 1}    0.24{col 47}{space 3}0.808{col 55}{space 4}-.0039701{col 68}{space 3} .0050952
{txt}{space 5}ch_group {c |}{col 15}{res}{space 2} .0036913{col 27}{space 2} .0035657{col 38}{space 1}    1.04{col 47}{space 3}0.301{col 55}{space 4}-.0032974{col 68}{space 3} .0106799
{txt}{space 1}conflictyear {c |}{col 15}{res}{space 2} .2708017{col 27}{space 2}  .125099{col 38}{space 1}    2.16{col 47}{space 3}0.030{col 55}{space 4} .0256122{col 68}{space 3} .5159912
{txt}softratio_lag {c |}{col 15}{res}{space 2} .2117629{col 27}{space 2}  .130572{col 38}{space 1}    1.62{col 47}{space 3}0.105{col 55}{space 4}-.0441536{col 68}{space 3} .4676794
{txt}{space 9}size {c |}{col 15}{res}{space 2} .0789852{col 27}{space 2} .0545304{col 38}{space 1}    1.45{col 47}{space 3}0.147{col 55}{space 4}-.0278924{col 68}{space 3} .1858627
{txt}{space 7}ln_gdp {c |}{col 15}{res}{space 2} .0263996{col 27}{space 2} .0539813{col 38}{space 1}    0.49{col 47}{space 3}0.625{col 55}{space 4}-.0794018{col 68}{space 3}  .132201
{txt}{space 7}ln_pop {c |}{col 15}{res}{space 2}-.1680373{col 27}{space 2} .0567339{col 38}{space 1}   -2.96{col 47}{space 3}0.003{col 55}{space 4}-.2792337{col 68}{space 3} -.056841
{txt}{space 8}pts_a {c |}{col 15}{res}{space 2} .0116952{col 27}{space 2} .0601532{col 38}{space 1}    0.19{col 47}{space 3}0.846{col 55}{space 4}-.1062029{col 68}{space 3} .1295933
{txt}{space 6}efindex {c |}{col 15}{res}{space 2} .4175007{col 27}{space 2} .2448965{col 38}{space 1}    1.70{col 47}{space 3}0.088{col 55}{space 4}-.0624876{col 68}{space 3}  .897489
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} 2.677374{col 27}{space 2} 1.086321{col 38}{space 1}    2.46{col 47}{space 3}0.014{col 55}{space 4} .5482238{col 68}{space 3} 4.806524
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. * Infighting as (Logged) Count (Models 4-6, Table 2)
. glm softratio ln_infight, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-1203.8159}  
Iteration 1:{space 2}Log pseudolikelihood = {res:-1203.6341}  
Iteration 2:{space 2}Log pseudolikelihood = {res:-1203.6341}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     2,194
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     2,192
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20}  1359.62339{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70} .6202661
{txt}Pearson{col 18}={res}{col 20} 1050.634473{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70}  .479304

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.099028
{txt}Log pseudolikelihood{col 22}= {res}-1203.634062{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-15504.49

{txt}{ralign 78:(Std. err. adjusted for {res:290} clusters in {res:gtdname})}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}   softratio{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}ln_infight {c |}{col 14}{res}{space 2}-.1365767{col 26}{space 2} .0471944{col 37}{space 1}   -2.89{col 46}{space 3}0.004{col 54}{space 4} -.229076{col 67}{space 3}-.0440775
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .4695564{col 26}{space 2} .0547948{col 37}{space 1}    8.57{col 46}{space 3}0.000{col 54}{space 4} .3621605{col 67}{space 3} .5769523
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. glm softratio ln_infight nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-1162.5392}  
Iteration 1:{space 2}Log pseudolikelihood = {res: -1162.377}  
Iteration 2:{space 2}Log pseudolikelihood = {res: -1162.377}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     2,145
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     2,131
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20} 1306.899684{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70}   .61328
{txt}Pearson{col 18}={res}{col 20} 1012.879641{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70} .4753072

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.096855
{txt}Log pseudolikelihood{col 22}= {res}-1162.376967{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-15039.78

{txt}{ralign 79:(Std. err. adjusted for {res:289} clusters in {res:gtdname})}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}    softratio{col 15}{c |} Coefficient{col 27}  std. err.{col 39}      z{col 47}   P>|z|{col 55}     [95% con{col 68}f. interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}ln_infight {c |}{col 15}{res}{space 2}-.2421183{col 27}{space 2} .0455698{col 38}{space 1}   -5.31{col 47}{space 3}0.000{col 55}{space 4}-.3314335{col 68}{space 3}-.1528031
{txt}{space 10}nat {c |}{col 15}{res}{space 2}-.1681014{col 27}{space 2} .1482533{col 38}{space 1}   -1.13{col 47}{space 3}0.257{col 55}{space 4}-.4586725{col 68}{space 3} .1224697
{txt}{space 9}left {c |}{col 15}{res}{space 2}-.4160275{col 27}{space 2} .1612731{col 38}{space 1}   -2.58{col 47}{space 3}0.010{col 55}{space 4} -.732117{col 68}{space 3} -.099938
{txt}{space 8}right {c |}{col 15}{res}{space 2} .0166469{col 27}{space 2} .4190822{col 38}{space 1}    0.04{col 47}{space 3}0.968{col 55}{space 4}-.8047391{col 68}{space 3} .8380328
{txt}{space 10}rel {c |}{col 15}{res}{space 2} .2075447{col 27}{space 2} .1623905{col 38}{space 1}    1.28{col 47}{space 3}0.201{col 55}{space 4}-.1107348{col 68}{space 3} .5258241
{txt}{space 3}regimetype {c |}{col 15}{res}{space 2}-.0147852{col 27}{space 2} .1066553{col 38}{space 1}   -0.14{col 47}{space 3}0.890{col 55}{space 4}-.2238258{col 68}{space 3} .1942554
{txt}{space 2}foreignspon {c |}{col 15}{res}{space 2}-.0734471{col 27}{space 2} .0889318{col 38}{space 1}   -0.83{col 47}{space 3}0.409{col 55}{space 4}-.2477503{col 68}{space 3} .1008561
{txt}{space 4}territory {c |}{col 15}{res}{space 2} .1520694{col 27}{space 2} .0856418{col 38}{space 1}    1.78{col 47}{space 3}0.076{col 55}{space 4}-.0157854{col 68}{space 3} .3199241
{txt}{space 6}attacks {c |}{col 15}{res}{space 2} .0008324{col 27}{space 2} .0004386{col 38}{space 1}    1.90{col 47}{space 3}0.058{col 55}{space 4}-.0000273{col 68}{space 3} .0016921
{txt}{space 6}n_group {c |}{col 15}{res}{space 2}-.0000536{col 27}{space 2} .0003476{col 38}{space 1}   -0.15{col 47}{space 3}0.877{col 55}{space 4}-.0007348{col 68}{space 3} .0006276
{txt}{space 5}ch_group {c |}{col 15}{res}{space 2}-.0001308{col 27}{space 2} .0003915{col 38}{space 1}   -0.33{col 47}{space 3}0.738{col 55}{space 4}-.0008981{col 68}{space 3} .0006366
{txt}{space 1}conflictyear {c |}{col 15}{res}{space 2} .1063946{col 27}{space 2} .0951922{col 38}{space 1}    1.12{col 47}{space 3}0.264{col 55}{space 4}-.0801788{col 68}{space 3}  .292968
{txt}softratio_lag {c |}{col 15}{res}{space 2}  .194254{col 27}{space 2} .1041677{col 38}{space 1}    1.86{col 47}{space 3}0.062{col 55}{space 4}-.0099111{col 68}{space 3}  .398419
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} .4060687{col 27}{space 2} .1746636{col 38}{space 1}    2.32{col 47}{space 3}0.020{col 55}{space 4} .0637343{col 68}{space 3} .7484032
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. glm softratio ln_infight nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag size ln_gdp ln_pop pts_a efindex, family(binomial) link(logit) cluster(gtdname)
{txt}note: softratio has noninteger values
{res}
{txt}Iteration 0:{space 2}Log pseudolikelihood = {res:-596.18349}  
Iteration 1:{space 2}Log pseudolikelihood = {res:-596.12339}  
Iteration 2:{space 2}Log pseudolikelihood = {res:-596.12339}  
{res}
{txt}Generalized linear models{col 51}Number of obs{col 67}={col 69}{res}     1,121
{txt}Optimization     : {res}ML{txt}{col 51}Residual df{col 67}={col 69}{res}     1,102
{col 20}{txt}{col 51}Scale parameter{col 67}={col 70}{res}        1
{txt}Deviance{col 18}={res}{col 20} 645.1647729{txt}{col 51}(1/df) Deviance{col 67}={res}{col 70}  .585449
{txt}Pearson{col 18}={res}{col 20} 501.5060003{txt}{col 51}(1/df) Pearson{col 67}={res}{col 70} .4550871

{txt}Variance function: {res}V(u) = {col 27}u*(1-u/1){col 51}{txt}[{res}Binomial{txt}]
Link function    : {res}g(u) = {col 27}ln(u/(1-u)){col 51}{txt}[{res}Logit{txt}]

{col 51}{help j_glmic##|_new:AIC}{col 67}={res}{col 70} 1.097455
{txt}Log pseudolikelihood{col 22}= {res}-596.1233866{txt}{col 51}{help j_glmic##|_new:BIC}{col 67}={res}{col 70}-7093.053

{txt}{ralign 79:(Std. err. adjusted for {res:165} clusters in {res:gtdname})}
{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}    Robust
{col 1}    softratio{col 15}{c |} Coefficient{col 27}  std. err.{col 39}      z{col 47}   P>|z|{col 55}     [95% con{col 68}f. interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}ln_infight {c |}{col 15}{res}{space 2}-.2414529{col 27}{space 2} .0664588{col 38}{space 1}   -3.63{col 47}{space 3}0.000{col 55}{space 4}-.3717099{col 68}{space 3} -.111196
{txt}{space 10}nat {c |}{col 15}{res}{space 2}-.4285071{col 27}{space 2} .1763288{col 38}{space 1}   -2.43{col 47}{space 3}0.015{col 55}{space 4}-.7741052{col 68}{space 3}-.0829089
{txt}{space 9}left {c |}{col 15}{res}{space 2}-.5671486{col 27}{space 2} .1725401{col 38}{space 1}   -3.29{col 47}{space 3}0.001{col 55}{space 4} -.905321{col 68}{space 3}-.2289762
{txt}{space 8}right {c |}{col 15}{res}{space 2} .1345428{col 27}{space 2} .4775635{col 38}{space 1}    0.28{col 47}{space 3}0.778{col 55}{space 4}-.8014645{col 68}{space 3}  1.07055
{txt}{space 10}rel {c |}{col 15}{res}{space 2} .1217674{col 27}{space 2} .2145945{col 38}{space 1}    0.57{col 47}{space 3}0.570{col 55}{space 4}-.2988302{col 68}{space 3}  .542365
{txt}{space 3}regimetype {c |}{col 15}{res}{space 2} .1615016{col 27}{space 2} .1462258{col 38}{space 1}    1.10{col 47}{space 3}0.269{col 55}{space 4}-.1250957{col 68}{space 3} .4480989
{txt}{space 2}foreignspon {c |}{col 15}{res}{space 2}-.0107742{col 27}{space 2} .0946487{col 38}{space 1}   -0.11{col 47}{space 3}0.909{col 55}{space 4}-.1962822{col 68}{space 3} .1747338
{txt}{space 4}territory {c |}{col 15}{res}{space 2}-.0917209{col 27}{space 2} .0962653{col 38}{space 1}   -0.95{col 47}{space 3}0.341{col 55}{space 4}-.2803974{col 68}{space 3} .0969556
{txt}{space 6}attacks {c |}{col 15}{res}{space 2} -.000038{col 27}{space 2} .0005244{col 38}{space 1}   -0.07{col 47}{space 3}0.942{col 55}{space 4}-.0010658{col 68}{space 3} .0009899
{txt}{space 6}n_group {c |}{col 15}{res}{space 2} .0005521{col 27}{space 2}  .002424{col 38}{space 1}    0.23{col 47}{space 3}0.820{col 55}{space 4} -.004199{col 68}{space 3} .0053031
{txt}{space 5}ch_group {c |}{col 15}{res}{space 2} .0035599{col 27}{space 2}  .003546{col 38}{space 1}    1.00{col 47}{space 3}0.315{col 55}{space 4}-.0033902{col 68}{space 3} .0105099
{txt}{space 1}conflictyear {c |}{col 15}{res}{space 2} .2857648{col 27}{space 2}   .12334{col 38}{space 1}    2.32{col 47}{space 3}0.021{col 55}{space 4} .0440228{col 68}{space 3} .5275067
{txt}softratio_lag {c |}{col 15}{res}{space 2} .2010519{col 27}{space 2} .1314943{col 38}{space 1}    1.53{col 47}{space 3}0.126{col 55}{space 4}-.0566722{col 68}{space 3} .4587761
{txt}{space 9}size {c |}{col 15}{res}{space 2} .0696184{col 27}{space 2} .0540259{col 38}{space 1}    1.29{col 47}{space 3}0.198{col 55}{space 4}-.0362705{col 68}{space 3} .1755073
{txt}{space 7}ln_gdp {c |}{col 15}{res}{space 2} .0354365{col 27}{space 2} .0546162{col 38}{space 1}    0.65{col 47}{space 3}0.516{col 55}{space 4}-.0716092{col 68}{space 3} .1424822
{txt}{space 7}ln_pop {c |}{col 15}{res}{space 2}-.1716058{col 27}{space 2} .0563078{col 38}{space 1}   -3.05{col 47}{space 3}0.002{col 55}{space 4}-.2819671{col 68}{space 3}-.0612444
{txt}{space 8}pts_a {c |}{col 15}{res}{space 2} .0075606{col 27}{space 2} .0593168{col 38}{space 1}    0.13{col 47}{space 3}0.899{col 55}{space 4}-.1086982{col 68}{space 3} .1238194
{txt}{space 6}efindex {c |}{col 15}{res}{space 2} .4839217{col 27}{space 2} .2447456{col 38}{space 1}    1.98{col 47}{space 3}0.048{col 55}{space 4} .0042292{col 68}{space 3} .9636142
{txt}{space 8}_cons {c |}{col 15}{res}{space 2} 2.661365{col 27}{space 2} 1.078246{col 38}{space 1}    2.47{col 47}{space 3}0.014{col 55}{space 4} .5480415{col 68}{space 3} 4.774689
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. * Predicted Proportions (Figure 3)
. * Presence of Violent Competition (Figure 3a)
. quietly glm softratio i.infight_b nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag, family(binomial) link(logit) cluster(gtdname)
{txt}
{com}. 
. margins i.infight_b, post
{res}
{txt}{col 1}Predictive margins{col 58}{lalign 13:Number of obs}{col 71} = {res}{ralign 5:2,145}
{txt}{col 1}Model VCE: {res:Robust}

{txt}{p2colset 1 13 13 2}{...}
{p2col:Expression:}{res:Predicted mean softratio, predict()}{p_end}
{p2colreset}{...}

{res}{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26} Delta-method
{col 14}{c |}     Margin{col 26}   std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}
{space 10}0  {c |}{col 14}{res}{space 2} .6312802{col 26}{space 2} .0118681{col 37}{space 1}   53.19{col 46}{space 3}0.000{col 54}{space 4} .6080192{col 67}{space 3} .6545413
{txt}{space 10}1  {c |}{col 14}{res}{space 2} .4843447{col 26}{space 2} .0185012{col 37}{space 1}   26.18{col 46}{space 3}0.000{col 54}{space 4} .4480829{col 67}{space 3} .5206064
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. coefplot (., keep(0.infight_b) bcolor(navy)) ///
>                  (., keep(1.infight_b) bcolor(bluishgray)) /// 
>                  , vertical legend(off) nooffsets recast(bar) barwidth(0.8) fcolor(*.8) ///
>            citop ciopts(recast(rcap) lcol(black)) citype() ///
>        coeflabels(, notick labgap(2)) plotregion(margin(b=0)) ///
>            ylabel(0(0.1)0.7) ytitle(Predicted Proportion of Attacks on Soft Targets) ///
>            xlabel(1 "No Violent Competition" 2 "Violent Competition")  ///
>            addplot(scatter @b @at, ms(i) mlabel(@b) mlabformat(%4.3f) mlabpos(2) mlabcolor(black))
{res}{txt}
{com}. 
. * Intensity of Violent Competition (Figure 3b)
. quietly glm softratio c.ln_infight nat left right rel regimetype foreignspon territory attacks n_group ch_group conflictyear softratio_lag, family(binomial) link(logit) cluster(gtdname)
{txt}
{com}. 
. margins, at(ln_infight=(0(1)10))
{res}
{txt}{col 1}Predictive margins{col 58}{lalign 13:Number of obs}{col 71} = {res}{ralign 5:2,145}
{txt}{col 1}Model VCE: {res:Robust}

{txt}{p2colset 1 13 13 2}{...}
{p2col:Expression:}{res:Predicted mean softratio, predict()}{p_end}
{p2colreset}{...}
{lalign 8:1._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:0}}
{lalign 8:2._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:1}}
{lalign 8:3._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:2}}
{lalign 8:4._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:3}}
{lalign 8:5._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:4}}
{lalign 8:6._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:5}}
{lalign 8:7._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:6}}
{lalign 8:8._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:7}}
{lalign 8:9._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:8}}
{lalign 8:10._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:9}}
{lalign 8:11._at: }{space 0}{lalign 10:ln_infight} = {res:{ralign 2:10}}

{res}{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26} Delta-method
{col 14}{c |}     Margin{col 26}   std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}_at {c |}
{space 10}1  {c |}{col 14}{res}{space 2} .6243089{col 26}{space 2}  .011627{col 37}{space 1}   53.69{col 46}{space 3}0.000{col 54}{space 4} .6015205{col 67}{space 3} .6470973
{txt}{space 10}2  {c |}{col 14}{res}{space 2} .5668939{col 26}{space 2} .0131861{col 37}{space 1}   42.99{col 46}{space 3}0.000{col 54}{space 4} .5410496{col 67}{space 3} .5927381
{txt}{space 10}3  {c |}{col 14}{res}{space 2} .5076624{col 26}{space 2} .0213367{col 37}{space 1}   23.79{col 46}{space 3}0.000{col 54}{space 4} .4658432{col 67}{space 3} .5494816
{txt}{space 10}4  {c |}{col 14}{res}{space 2}  .448231{col 26}{space 2} .0309496{col 37}{space 1}   14.48{col 46}{space 3}0.000{col 54}{space 4}  .387571{col 67}{space 3}  .508891
{txt}{space 10}5  {c |}{col 14}{res}{space 2} .3902356{col 26}{space 2} .0398273{col 37}{space 1}    9.80{col 46}{space 3}0.000{col 54}{space 4} .3121756{col 67}{space 3} .4682956
{txt}{space 10}6  {c |}{col 14}{res}{space 2} .3351596{col 26}{space 2} .0469431{col 37}{space 1}    7.14{col 46}{space 3}0.000{col 54}{space 4} .2431528{col 67}{space 3} .4271663
{txt}{space 10}7  {c |}{col 14}{res}{space 2} .2841938{col 26}{space 2}  .051786{col 37}{space 1}    5.49{col 46}{space 3}0.000{col 54}{space 4} .1826952{col 67}{space 3} .3856924
{txt}{space 10}8  {c |}{col 14}{res}{space 2} .2381553{col 26}{space 2}  .054228{col 37}{space 1}    4.39{col 46}{space 3}0.000{col 54}{space 4} .1318704{col 67}{space 3} .3444402
{txt}{space 10}9  {c |}{col 14}{res}{space 2} .1974703{col 26}{space 2} .0544385{col 37}{space 1}    3.63{col 46}{space 3}0.000{col 54}{space 4} .0907728{col 67}{space 3} .3041677
{txt}{space 9}10  {c |}{col 14}{res}{space 2} .1622126{col 26}{space 2} .0527838{col 37}{space 1}    3.07{col 46}{space 3}0.002{col 54}{space 4} .0587582{col 67}{space 3}  .265667
{txt}{space 9}11  {c |}{col 14}{res}{space 2} .1321767{col 26}{space 2}  .049725{col 37}{space 1}    2.66{col 46}{space 3}0.008{col 54}{space 4} .0347174{col 67}{space 3} .2296359
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. marginsplot, recast(line) recastci(rarea) ///
> ciopt(color(bluishgray)) plot1opts(lc(navy) lpattern(solid)) ///
> ytitle("Predicted Proportion of Attacks on Soft Targets") ///
> xtitle("Infighting Attacks (log)") ///
> ylab(0(0.1)0.7, nogrid) title("")
{res}
{text}{p 0 0 2}Variables that uniquely identify margins: {bf:ln_infight}{p_end}
{res}{txt}
{com}. 
. **********************************************
. * MICRO-LEVEL ANALYSIS
. **********************************************
. 
. * Figure 4
. use figure4.dta, clear
{txt}
{com}. sort date
{txt}
{com}. twoway (bar softratio date, sort fcolor(ltblue%80) lcolor(ltblue)) (line infight date, sort yaxis(2) lcolor(navy)), xtitle("") ytitle("Proportion of ISIS Attacks on Soft Targets") ytitle("ISIS Infighting Attacks", axis(2)) legend(label(1 "Soft Ratio") label(2 "Infighting Attacks"))
{res}{txt}
{com}. 
. * Set up
. use syria.dta, clear
{txt}
{com}. xtset id modate
{res}
{col 1}{txt:Panel variable: }{res:id}{txt: (strongly balanced)}
{p 1 16 2}{txt:Time variable: }{res:modate}{txt:, }{res:{bind:636}}{txt: to }{res:{bind:707}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. 
. * Linear Model with District and Temporal FE (Table 3)
. xtreg softratio infight_b softratiolag i.iyear, fe vce(cluster id)
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       129
{txt}Group variable: {res}id{txt}{col 49}Number of groups{col 67}={col 69}{res}        18

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.2240{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.1024{col 63}{txt}avg{col 67}={col 69}{res}       7.2
{txt}     Overall = {res}0.1639{col 63}{txt}max{col 67}={col 69}{res}        28

{txt}{col 49}F({res}7{txt}, {res}17{txt}){col 67}={col 70}{res}  2544.90
{txt}corr(u_i, Xb) = {res}-0.1528{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{ralign 78:(Std. err. adjusted for {res:18} clusters in {res:id})}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}   softratio{col 14}{c |} Coefficient{col 26}  std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}{col 14}{res}{space 2}-.3769801{col 26}{space 2} .0649461{col 37}{space 1}   -5.80{col 46}{space 3}0.000{col 54}{space 4}-.5140044{col 67}{space 3}-.2399558
{txt}softratiolag {c |}{col 14}{res}{space 2}-.1933144{col 26}{space 2} .0920038{col 37}{space 1}   -2.10{col 46}{space 3}0.051{col 54}{space 4}-.3874254{col 67}{space 3} .0007966
{txt}{space 12} {c |}
{space 7}iyear {c |}
{space 7}2014  {c |}{col 14}{res}{space 2}-.3219574{col 26}{space 2} .0591025{col 37}{space 1}   -5.45{col 46}{space 3}0.000{col 54}{space 4}-.4466528{col 67}{space 3}-.1972619
{txt}{space 7}2015  {c |}{col 14}{res}{space 2} -.488643{col 26}{space 2} .0577698{col 37}{space 1}   -8.46{col 46}{space 3}0.000{col 54}{space 4}-.6105267{col 67}{space 3}-.3667594
{txt}{space 7}2016  {c |}{col 14}{res}{space 2}-.4083103{col 26}{space 2} .0768826{col 37}{space 1}   -5.31{col 46}{space 3}0.000{col 54}{space 4}-.5705184{col 67}{space 3}-.2461022
{txt}{space 7}2017  {c |}{col 14}{res}{space 2}-.5721134{col 26}{space 2} .0855936{col 37}{space 1}   -6.68{col 46}{space 3}0.000{col 54}{space 4}-.7527002{col 67}{space 3}-.3915267
{txt}{space 7}2018  {c |}{col 14}{res}{space 2}-.5100218{col 26}{space 2} .1020902{col 37}{space 1}   -5.00{col 46}{space 3}0.000{col 54}{space 4}-.7254132{col 67}{space 3}-.2946303
{txt}{space 12} {c |}
{space 7}_cons {c |}{col 14}{res}{space 2} 1.119894{col 26}{space 2} .0826941{col 37}{space 1}   13.54{col 46}{space 3}0.000{col 54}{space 4} .9454245{col 67}{space 3} 1.294363
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .33324953
     {txt}sigma_e {c |} {res} .37575687
         {txt}rho {c |} {res} .44026133{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}

{com}. xtreg softratio infight_b deathsb attacks territory tax_index services_index softratiolag i.iyear, fe vce(cluster id)
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       129
{txt}Group variable: {res}id{txt}{col 49}Number of groups{col 67}={col 69}{res}        18

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.2650{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.1026{col 63}{txt}avg{col 67}={col 69}{res}       7.2
{txt}     Overall = {res}0.1448{col 63}{txt}max{col 67}={col 69}{res}        28

{txt}{col 49}F({res}12{txt}, {res}17{txt}){col 67}={col 70}{res}  3535.53
{txt}corr(u_i, Xb) = {res}-0.3121{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{ralign 80:(Std. err. adjusted for {res:18} clusters in {res:id})}
{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 16}{c |}{col 28}    Robust
{col 1}     softratio{col 16}{c |} Coefficient{col 28}  std. err.{col 40}      t{col 48}   P>|t|{col 56}     [95% con{col 69}f. interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}infight_b {c |}{col 16}{res}{space 2}-.4465967{col 28}{space 2} .0805853{col 39}{space 1}   -5.54{col 48}{space 3}0.000{col 56}{space 4}-.6166168{col 69}{space 3}-.2765766
{txt}{space 7}deathsb {c |}{col 16}{res}{space 2}-.0024685{col 28}{space 2} .0008891{col 39}{space 1}   -2.78{col 48}{space 3}0.013{col 56}{space 4}-.0043443{col 69}{space 3}-.0005927
{txt}{space 7}attacks {c |}{col 16}{res}{space 2}  .015448{col 28}{space 2} .0085557{col 39}{space 1}    1.81{col 48}{space 3}0.089{col 56}{space 4}-.0026029{col 69}{space 3} .0334989
{txt}{space 5}territory {c |}{col 16}{res}{space 2} .0322704{col 28}{space 2} .0948832{col 39}{space 1}    0.34{col 48}{space 3}0.738{col 56}{space 4}-.1679157{col 69}{space 3} .2324566
{txt}{space 5}tax_index {c |}{col 16}{res}{space 2}  .017949{col 28}{space 2} .0244769{col 39}{space 1}    0.73{col 48}{space 3}0.473{col 56}{space 4}-.0336928{col 69}{space 3} .0695908
{txt}services_index {c |}{col 16}{res}{space 2}-.0151473{col 28}{space 2} .0413214{col 39}{space 1}   -0.37{col 48}{space 3}0.718{col 56}{space 4}-.1023278{col 69}{space 3} .0720332
{txt}{space 2}softratiolag {c |}{col 16}{res}{space 2}-.2577651{col 28}{space 2} .0969607{col 39}{space 1}   -2.66{col 48}{space 3}0.017{col 56}{space 4}-.4623344{col 69}{space 3}-.0531959
{txt}{space 14} {c |}
{space 9}iyear {c |}
{space 9}2014  {c |}{col 16}{res}{space 2}-.3194033{col 28}{space 2} .0396348{col 39}{space 1}   -8.06{col 48}{space 3}0.000{col 56}{space 4}-.4030254{col 69}{space 3}-.2357811
{txt}{space 9}2015  {c |}{col 16}{res}{space 2}-.5169205{col 28}{space 2}   .06131{col 39}{space 1}   -8.43{col 48}{space 3}0.000{col 56}{space 4}-.6462733{col 69}{space 3}-.3875678
{txt}{space 9}2016  {c |}{col 16}{res}{space 2}-.4284405{col 28}{space 2} .0904613{col 39}{space 1}   -4.74{col 48}{space 3}0.000{col 56}{space 4} -.619297{col 69}{space 3}-.2375839
{txt}{space 9}2017  {c |}{col 16}{res}{space 2}-.5496309{col 28}{space 2} .1343089{col 39}{space 1}   -4.09{col 48}{space 3}0.001{col 56}{space 4} -.832998{col 69}{space 3}-.2662638
{txt}{space 9}2018  {c |}{col 16}{res}{space 2}-.5837095{col 28}{space 2} .1696693{col 39}{space 1}   -3.44{col 48}{space 3}0.003{col 56}{space 4}-.9416804{col 69}{space 3}-.2257386
{txt}{space 14} {c |}
{space 9}_cons {c |}{col 16}{res}{space 2} 1.154828{col 28}{space 2}  .127699{col 39}{space 1}    9.04{col 48}{space 3}0.000{col 56}{space 4} .8854068{col 69}{space 3}  1.42425
{txt}{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
       sigma_u {c |} {res} .33791186
       {txt}sigma_e {c |} {res} .37481813
           {txt}rho {c |} {res} .44835691{txt}   (fraction of variance due to u_i)
{hline 15}{c BT}{hline 64}

{com}. 
. 
. * Predicted Proportions (Figure 5)
. quietly xtreg softratio i.infight_b deathsb attacks territory tax_index services_index softratiolag i.iyear, fe vce(cluster id)
{txt}
{com}. 
. margins i.infight_b, post
{res}
{txt}{col 1}Predictive margins{col 60}{lalign 13:Number of obs}{col 73} = {res}{ralign 3:129}
{txt}{col 1}Model VCE: {res:Robust}

{txt}{p2colset 1 13 13 2}{...}
{p2col:Expression:}{res:Linear prediction, predict()}{p_end}
{p2colreset}{...}

{res}{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26} Delta-method
{col 14}{c |}     Margin{col 26}   std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}
{space 10}0  {c |}{col 14}{res}{space 2} .6024196{col 26}{space 2} .0212395{col 37}{space 1}   28.36{col 46}{space 3}0.000{col 54}{space 4} .5607909{col 67}{space 3} .6440483
{txt}{space 10}1  {c |}{col 14}{res}{space 2} .1558229{col 26}{space 2} .0593458{col 37}{space 1}    2.63{col 46}{space 3}0.009{col 54}{space 4} .0395073{col 67}{space 3} .2721384
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. coefplot (., keep(0.infight_b) bcolor(navy)) ///
>                  (., keep(1.infight_b) bcolor(bluishgray)) /// 
>                  , vertical legend(off) nooffsets recast(bar) barwidth(0.8) fcolor(*.8) ///
>            citop ciopts(recast(rcap) lcol(black)) citype() ///
>        coeflabels(, notick labgap(2)) plotregion(margin(b=0)) ///
>            ylabel(0(0.1)0.7) ytitle(Predicted Proportion of Attacks on Soft Targets) ///
>            xlabel(1 "No Violent Competition" 2 "Violent Competition")  ///
>            addplot(scatter @b @at, ms(i) mlabel(@b) mlabformat(%4.3f) mlabpos(2) mlabcolor(black))  
{res}{txt}
{com}. 
. **********************************************
. * EXTENSIONS
. **********************************************
. 
. * In-group and Out-group Dynamics (Figure 6)
. * Sunni Locations (Figure 6a)
. quietly xtreg softratio i.infight_b deathsb attacks territory tax_index services_index softratiolag i.iyear, fe vce(cluster id), if sunni == 1
{txt}
{com}. margins i.infight_b, post
{res}
{txt}{col 1}Predictive margins{col 60}{lalign 13:Number of obs}{col 73} = {res}{ralign 3:123}
{txt}{col 1}Model VCE: {res:Robust}

{txt}{p2colset 1 13 13 2}{...}
{p2col:Expression:}{res:Linear prediction, predict()}{p_end}
{p2colreset}{...}

{res}{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26} Delta-method
{col 14}{c |}     Margin{col 26}   std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}
{space 10}0  {c |}{col 14}{res}{space 2} .5923594{col 26}{space 2} .0202783{col 37}{space 1}   29.21{col 46}{space 3}0.000{col 54}{space 4} .5526147{col 67}{space 3} .6321042
{txt}{space 10}1  {c |}{col 14}{res}{space 2} .1708192{col 26}{space 2} .0530815{col 37}{space 1}    3.22{col 46}{space 3}0.001{col 54}{space 4} .0667814{col 67}{space 3}  .274857
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. coefplot, vertical legend(off) nooffsets recast(bar) barwidth(0.8) fcolor(*.8) ///
>        bcolor(navy) ///
>            citop ciopts(recast(rcap) lcol(black)) citype() ///
>        coeflabels(, notick labgap(2)) plotregion(margin(b=0)) ///
>            ylabel(0(0.1)0.7) ytitle(Predicted Proportion of Attacks on Soft Targets) ///
>            xlabel(1 "No Violent Competition" 2 "Violent Competition")  ///
>            addplot(scatter @b @at, ms(i) mlabel(@b) mlabformat(%4.3f) mlabpos(2) mlabcolor(black)) 
{res}{txt}
{com}. 
. * Non-Sunni and Mixed Locations (Figure 6b)
. quietly xtreg softratio i.infight_b deathsb attacks territory tax_index services_index softratiolag i.iyear, fe vce(cluster id), if mixed2 | nonsunni == 1
{txt}
{com}. margins i.infight_b, post
{res}
{txt}{col 1}Predictive margins{col 61}{lalign 13:Number of obs}{col 74} = {res}{ralign 2:91}
{txt}{col 1}Model VCE: {res:Robust}

{txt}{p2colset 1 13 13 2}{...}
{p2col:Expression:}{res:Linear prediction, predict()}{p_end}
{p2colreset}{...}

{res}{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26} Delta-method
{col 14}{c |}     Margin{col 26}   std. err.{col 38}      z{col 46}   P>|z|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}infight_b {c |}
{space 10}0  {c |}{col 14}{res}{space 2} .6890697{col 26}{space 2} .0304035{col 37}{space 1}   22.66{col 46}{space 3}0.000{col 54}{space 4} .6294798{col 67}{space 3} .7486595
{txt}{space 10}1  {c |}{col 14}{res}{space 2} .1915008{col 26}{space 2}  .068408{col 37}{space 1}    2.80{col 46}{space 3}0.005{col 54}{space 4} .0574237{col 67}{space 3}  .325578
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. coefplot, vertical legend(off) nooffsets recast(bar) barwidth(0.8) fcolor(*.8) ///
>        bcolor(bluishgray) ///
>            citop ciopts(recast(rcap) lcol(black)) citype() ///
>        coeflabels(, notick labgap(2)) plotregion(margin(b=0)) ///
>            ylabel(0(0.1)0.7) ytitle(Predicted Proportion of Attacks on Soft Targets) ///
>            xlabel(1 "No Violent Competition" 2 "Violent Competition")  ///
>            addplot(scatter @b @at, ms(i) mlabel(@b) mlabformat(%4.3f) mlabpos(2) mlabcolor(black))
{res}{txt}
{com}.            
. * Brutality of Competitors (Figure 7)
. quietly xtreg soft c.infight##c.soft_comp deaths_is deathsb attacks territory tax_index services_index softratiolag i.iyear, fe vce(cluster id)
{txt}
{com}. quietly margins, at(infight=(0(1)7) soft_comp=(0(5)25)) saving(predictions, replace)
{txt}
{com}. 
. use predictions, clear
{txt}(Created by command margins; also see char list)

{com}. rename _at1 infight
{res}{txt}
{com}. rename _at2 soft_comp
{res}{txt}
{com}. rename _margin pr_soft
{res}{txt}
{com}. 
. twoway  (contour pr_soft infight soft_comp, crule(intensity) ecolor(navy)), xlabel(0(5)25) ylabel(0(1)7, angle(horizontal)) xtitle("Attacks on Soft Targets by ISIS Competitors") ytitle("Infighting") ztitle("Predicted Attacks on Soft Targets by ISIS") title("")
{res}{txt}
{com}. 
. 
{txt}end of do-file

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/bjw9936/Desktop/Polo_Welsh_IO/01_Main/main_log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}15 Apr 2024, 17:45:30
{txt}{.-}
{smcl}
{txt}{sf}{ul off}